package com.xbongbong.pro.statistic.pojo.dto;

import com.xbongbong.paas.toolbox.util.StringUtil;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Map;

/**
 * @author zcp
 * @version v1.0
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class DataSetListDTO extends BaseDTO {
    private static final long serialVersionUID = -9172970458943887919L;
    /**
     * 名称模糊查询
     */
    private String nameLike;
    /**
     * 创建人查询
     */
    private String creatorId;
    /**
     * 当前页
     */
    private Integer page;
    /**
     * 每页数量
     */
    private Integer pageSize;
    /**
     * 排序字段{"field":"updateTime","sort":"acs"}
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Map<String, String> sortMap;

    /**
     * 参数接收完后的加工处理，
     * 比如nameLike的去除前后空格
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    public void postProcess() {
        if (StringUtil.isEmpty(this.nameLike)) {
            this.nameLike = null;
        } else {
            this.nameLike = StringUtil.trim(this.nameLike);
        }
    }
}
